#include "24c02.h"

void at24c02_write_one_byte(u8 address,u8 dat)
{
    iic_start();
    iic_write_byte(0xa0);
    iic_wait_ack();
    iic_write_byte(address);
    iic_wait_ack();
    iic_write_byte(dat);

    iic_wait_ack();

    iic_end();
}



u8 at24c02_read_one_byte(u8 address)
{
    u8 dat=0;
    iic_start();
    iic_write_byte(0xa0);
    iic_wait_ack();
    iic_write_byte(address);
    iic_wait_ack();
    iic_start();
    iic_write_byte(0xa1);
    iic_wait_ack();
//    iic_write_byte(address);
//    iic_wait_ack();
    dat=iic_read_byte();
//    iic_wait_ack();
    iic_end();
    return dat;
}